
#include "tasks/timer.h"
#include <drogon/drogon.h>

using namespace drogon;

int main() {
	try {
		app().loadConfigFile("./config.json");

		// CORS
		app().registerPostHandlingAdvice([](const HttpRequestPtr &req, const HttpResponsePtr &resp) {
			resp->addHeader("Access-Control-Allow-Origin", "*");
		});

		// Scheduler
		Timer timer;

		timer.start();

		app().run();

	} catch (const std::exception &e) {
		std::cout << "Application: err  " << e.what() << std::endl;
	}
	return 0;
}
